package carglassfish.ua.bionic.carrentals.managedbean;

import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import carglassfish.ua.bionic.carrentals.entities.User;
import carglassfish.ua.bionic.carrentals.entitybeans.userbean.UserBeanLocal;

@ManagedBean
@SessionScoped
public class Usermb {
	
	@EJB
	private UserBeanLocal userbean;
	
	private User user;
	private String login;
	private String password;
	
	public String findUser(){
		user=userbean.checkByLoginPassword(login, password);
		return "/xhtml/index.xhtml?faces-redirect=true";
	}
	
	public String outUser(){
		user=null;
		return "/xhtml/index.xhtml?faces-redirect=true";
	}
	
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public String getLogin() {
		return login;
	}

	public void setLogin(String login) {
		this.login = login;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}
	
	
}
